{extend name="admin@public/main"}

{block name="button"}
<xblock>
    {if auth("$classuri/add")}
    <button class="layui-btn layui-btn-xs" data-modal='{:url("$classuri/add")}' data-title="添加根节点">
        <i class="layui-icon"></i>添加节点
    </button>
    {/if}
    <span class="x-right" style="line-height:40px"></span>
</xblock>
{/block}

{block name="table"}
<table class="layui-table">
    <thead>
    <tr>
        <th width="10">id</th>
        <th width="50">菜单名称</th>
        <th width="100">url</th>
        <th width="100">操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="vo"}
    <tr>
        <td>{$vo.id}</td>
        <td>{$vo._pre|default=''}{$vo.title}</td>
        <td>{$vo.url}</td>
        <td>
            {if auth("$classuri/add")}
            <button class="layui-btn layui-btn-xs" href="javascript:;" data-title="添加子菜单" data-modal='{:url("$classuri/add")}?pid={$vo.id}'>
                添加子菜单
            </button>
            {/if}
            {if auth("$classuri/edit")}
            <button class="layui-btn layui-btn-xs" href="javascript:;" data-title="编辑菜单" data-modal='{:url("$classuri/edit")}?id={$vo.id}'>
                编辑
            </button>
            {/if}
            {if auth("$classuri/del")}
            <button class="layui-btn layui-btn-xs" href="javascript:;"
               data-confirm="确定要删除吗！" data-get='{:url("$classuri/del")}?ids={$vo.son_ids}'>
                删除
            </button>
            {/if}
        </td>
    </tr>
    {/volist}
    </tbody>
</table>
{/block}

{block name="script"}
<script>

</script>
{/block}